package com.ai.fzqai;

import org.junit.jupiter.api.Test;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.ChatClient.StreamResponseSpec;
import org.springframework.ai.openai.OpenAiChatModel;
import org.springframework.ai.openai.OpenAiChatOptions;
import org.springframework.ai.zhipuai.ZhiPuAiChatModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import com.ai.fzqai.config.HunyuanOpenAiChat;
import com.ai.fzqai.config.XinliuOpenAiChat;

@SpringBootTest
public class OpenAIIT    {
	 @Autowired
	 private  OpenAiChatModel openAiChatModel;
	 @Autowired
	 private  ZhiPuAiChatModel zhiPuAiChatModel;
	 @Autowired
	 private HunyuanOpenAiChat hunyuanChatClient;
	 @Autowired
	 private XinliuOpenAiChat xinliuOpenAiChat;
	 
	 @Test
	 public void 智谱() { 
		 hello( ChatClient.builder(zhiPuAiChatModel) .build()
				 );
	 }
	 @Test
	 public void 硅基() { 
		 hello( ChatClient.builder(openAiChatModel).build() );
	 }
	 
	 @Test
	 public void 混元() {
		 hello(ChatClient.builder(hunyuanChatClient.getChatModel()).build());
	 }

	 @Test
	 public void 心流() {
		 hello(ChatClient.builder(xinliuOpenAiChat.getChatModel())
				 .defaultOptions(
						 OpenAiChatOptions
						 .builder()
						 .model("deepseek-v3.2")
						 .build()
				 )
				 .build()
				 );
	 }

	private void hello( ChatClient chatClient) {
		StreamResponseSpec res = chatClient
	         .prompt("你好，很高兴认识你，能简单介绍一下自己吗？")
	         .stream()
            ;
		BaseRunTest.runAndPrint(res);
	}
	
}
